import 'package:flutter/material.dart';
import 'package:tiktokadult/assets_tool/images.dart';

import '../../../../hj_model/comment/comment_list_res.dart';
import '../../../../routers/jump_router.dart';

class HotSearchWidget extends StatelessWidget {
  final CommentLink model;

  const HotSearchWidget(this.model, {super.key});

  @override
  Widget build(BuildContext context) {
    return Container(
      margin: EdgeInsets.fromLTRB(12, 0, 12, 14),
      padding: EdgeInsets.only(bottom: 14),
      decoration: BoxDecoration(
        border: Border(bottom: BorderSide(color: Colors.white.withOpacity(0.05))),
      ),
      child: InkWell(
        onTap: linkJumpToEvent,
        child: Row(
          children: [
            const Text(
              "「限时活动」",
              style: TextStyle(
                color: Colors.white,
                fontSize: 14,
              ),
            ),
            Expanded(
              child: Row(
                mainAxisSize: MainAxisSize.min,
                crossAxisAlignment: CrossAxisAlignment.start,
                children: [
                  const SizedBox(width: 4),
                  Flexible(
                    child: Text(
                      model.title ?? "",
                      maxLines: 1,
                      overflow: TextOverflow.ellipsis,
                      style: const TextStyle(
                        color: Color(0xffDB361F),
                        fontSize: 14,
                      ),
                    ),
                  ),
                  Container(
                    alignment: Alignment.topLeft,
                    width: 10,
                    child: Image.asset(
                      "rich_search.png".commentPath,
                      width: 12,
                      height: 12,
                    ),
                  )
                ],
              ),
            )
          ],
        ),
      ),
    );
  }

  void linkJumpToEvent() {
    if (model.link?.isNotEmpty == true) {
      pushToPageByLink(model.link, id: model.id);
    } else {
      if (model.searchKeyword?.isNotEmpty == true) {
        //Map<String, dynamic> map = {"keywords": model.searchKeyword};
        //Get.to(() => const DomesticsSearchResultPage(), arguments: map);
      }
    }
  }
}
